package com.lhj.controller;

import com.lhj.model.MqttMessage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lhj
 * @Classname HelloController
 * @Description
 * @Date 2021/3/2 16:46
 * @Version V1.0
 */
@Api(value = "swagger 测试类")
@RestController
public class HelloController {


    @ApiOperation(value = "/getHello", notes = "get请求测试方法")
    @GetMapping(value = "/getHello")
    public Object getHello( /* 参数注解 */ @ApiParam(value = "测试参数", required = true) @RequestParam String name) {
        return "GetHello " + name + "!";
    }

    @ApiOperation(value = "/sendMessage", notes = "post请求测试方法")
    @PostMapping(value = "/sendMessage")
    public Object sendMessage(@RequestBody MqttMessage request) {
        return "PostHello " + request + "!";
    }

}
